<extend name="Public/base"/>
<block name="body">
    <div class="main-title" style="padding-bottom: 10px;">
        <h2>月结充值报表</h2>
    </div>
    <div class="cf">
    <form action="{:U('SpReport/overallmonthcharge')}" method='post' id="form-search" style="float: left;">
        <select name="shopId"  id="shopId" class="search-input">
            <option value='-1'>全部门店</option>
            <volist name='shoplist' id='vo'>
                <option value='{$vo.id}'<if condition="$vo.id eq $shopid">selected="selected"</if>>{$vo.name}</option>
            </volist>
        </select>
        开始时间：<input type="text" id="datetimeBegin" name="beginTime" value="{$beginTime}" />
        截止时间：<input type="text" id="datetimeEnd" name="endTime" value="{$endTime}" />
        <input type="submit" class="btn btn-primary" value="统计"/>
    </form>
        <div class="fl" style="float: left; margin-left: 15px;">
            <form method='POST' action="{:U('ExportOverallMonthCharge')}" id="form-export">
                <input type="hidden" id="shoplist" name="shopId" value=""/>
                <input type="hidden" id="beginTime" name="beginTime" value=""/>
                <input type="hidden" id="endTime" name="endTime" value=""/>
                <a class="btn btn-default" href="javascript:;" id="ExportSubmit" onclick="return getValue()">导出</a>
            </form>
        </div>
    </div>
    <div style="color: red;font-size: 16px;">
        当前时间段充值总额：{$totalChargeAmount}&nbsp;&nbsp;
        现金充值总额：{$totalChargeAmount_cash}&nbsp;&nbsp;
        银联充值总额：{$totalChargeAmount_unionpay}&nbsp;&nbsp;
        支付宝充值总额：{$totalChargeAmount_alipay}&nbsp;&nbsp;
        充值笔数： {$chargeCount}&nbsp;&nbsp;
        新办卡数量： {$membercardCount}
    </div>
    <div class="data-table table-striped" style="font-size: 13px;">
        <table>
            <thead>
            <tr>
                <th>日期</th>
                <th>面值金额</th>
                <th>赠送金额</th>
                <th>合计</th>
                <th>现金</th>
                <th>刷卡</th>
                <th>支付宝</th>
                <th>小计</th>
            </tr>
            </thead>
            <tbody>
            <notempty name="_list">
                <volist name="_list" id="vo">
                    <tr>
                        <td>{$vo[0]} </td>
                        <td>{$vo[1]} </td>
                        <td>{$vo[2]} </td>
                        <td>{$vo[3]} </td>
                        <td>{$vo[4]} </td>
                        <td>{$vo[5]} </td>
                        <td>{$vo[6]} </td>
                        <td>{$vo[7]} </td>
                    </tr>
                </volist>
                <else/>
                <td colspan="8" class="text-center"> aOh! 暂时还没有内容! </td>
            </notempty>
            </tbody>
        </table>
    </div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
    <script type="text/javascript">
        //搜索查询
        $('#submit').click(function () {
            document.getElementById("form-search").submit()
        });
        //导航高亮
        highlight_subnav('{:U('SpReport/overallmonthcharge')}');

        $(function () {
            $('#datetimeBegin').datetimepicker({
                timepicker:false,
                format:'Y-m-d',
                language: 'zh-CN',
                autoclose: true
            });
            $('#datetimeEnd').datetimepicker({
                timepicker:false,
                format:'Y-m-d',
                language: 'zh-CN',
                autoclose: true
            });
        })

        function getValue(){
            if($("#shopId option:selected").val().length>0&&$("#datetimeBegin").val().length>0&&$("#datetimeEnd").val().length>0){
                $("#shoplist").val($("#shopId").val()) ;
                $("#beginTime").val($("#datetimeBegin").val()) ;
                $("#endTime").val($("#datetimeEnd").val()) ;
                document.getElementById("form-export").submit();
            } else {
                return false;
            }
        }
    </script>
</block>